package javaBase.javaException;

/**
 * Created by Administrator on 2017/2/23 0023.
 */
public class Test {
    public void display(int i) throws MyException {
        if (i == 0) {
            throw new MyException("该值不能为0.......");
        } else {
            System.out.println(i / 2);
        }
    }

    public static void main(String[] args) {
        Test test = new Test();
        try {
            test.display(0);
            System.out.println("---------------------");
        } catch (MyException e) {
            e.printStackTrace();
        }
    }
}
